<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
<title>极客之家-修改博客</title>

<meta name="keywords" content="keyword1,keyword2,keyword3">
<meta name="description" content="this is my page">
<meta name="content-type" content="text/html; charset=UTF-8">

<link rel="stylesheet" href="<%=path %>/css/blog_write.css"> 
</head>

<body>

<jsp:include page="top.jsp"></jsp:include>

<div class="divBlock">
		<form role="form" action="" id="blog_write_form">
			<div class="cotainer table-responsive blog_table">
				<table class="table table-striped table-bordered">
					<caption class="text-center ">
						<h3>发表博客</h3>
					</caption>
					<thead></thead>
					<tbody>
						<!-- 本系统基本信息 开始 -->
						<tr>

							<td class="col-lg-3 col-md-3 col-sm-12 hidden-xs hidden-sm">标题</td>
							<td class="col-lg-9 col-md-9 col-sm-12">
								<div class="form-group">
									<input type="hidden" name="uuid" value="${uuid }" >
									<input type="text" name="title" id="edit_blog_title" value="${title }" class="form-control blog_write_input"
										placeholder="请输入您的博客标题">
								</div>
							</td>

						</tr> 
						<tr>
							<td class="col-lg-3 col-md-3 col-sm-12 hidden-xs hidden-sm">副标题</td>
							<td class="col-lg-9 col-md-9 col-sm-12 ">
								<div class="form-group">  
									<input type="text" name="subtitle" id="edit_blog_subtitle" value="${subtitle }" class="form-control blog_write_input"
										placeholder="请输入您的博客副标题">
								</div>
							</td>  

						</tr>
						<tr>
							<td class="col-lg-12 col-md-12 col-sm-12 blog_content " colspan="2">
								<!-- 加载编辑器的容器 --> 
								<textarea id="contentid" name="content" type="text/plain" style="height:600px;width:100%;" >${content } 
								</textarea>
							</td>

						</tr>

					</tbody>

				</table>
			</div>
		</form>
		
		<div class=" blog_commit_btns">
			<button type="submit" class="btn btn-info" id="blog_update_commit_btn">修改博客</button>
			<button type="submit" class="btn btn-warning" id="blog_commit_reset">重写本篇</button>
		</div>
		
	</div>

	<jsp:include page="footer.jsp"></jsp:include>

	<!-- 配置文件 --> 
	<script type="text/javascript" src="<%=path %>/js/ueditor/ueditor.config.js"></script>
	<!-- 编辑器源码文件 -->
	<script type="text/javascript" src="<%=path %>/js/ueditor/ueditor.all.js"></script>
	<script type="text/javascript" src="<%=path %>/js/writeblog.js"></script>
	<!-- 实例化编辑器 --> 
	<script type="text/javascript"> 
		var ue = UE.getEditor('contentid');
		var path='<%=basePath%>'; 
		
		$(function(){
			$("#blog_update_commit_btn").click(function(){
				
				updateBlog(ue,path);
			})
			
			/* 重置 form */
			$("#blog_commit_reset").click(function(){ 
				/*jquery 没有reset 方法，使用dom 的，reset 不能重置 textarea，手动重置 textarea */
				$("#blog_write_form")[0].reset();
				ue.setContent('');
			})
			
			/* $("#blog_commit_btn").on("click", function () {
				reset();
				alertify.confirm("Confirm?", function (e) { 
					if (e) {
						alertify.alert("Successful AJAX after OK");
					} else {
						alertify.alert("Successful AJAX after Cancel");
					}
				});
			}); */
			
		})
		
	</script>

</body>
</html>
